﻿using UnityEngine;

public class Settlement : MonoBehaviour
{
    [SerializeField] private string settlementName; // 定居点名称
    [SerializeField] private GameObject spritePrefab; // 定居点预制体
    [SerializeField] private int type; // 定居点类型
    [SerializeField] private int level;  // 等级
    [SerializeField] private int maxLevel;  // 最大等级
    [SerializeField] private int soilderCount; // 兵力
    [SerializeField] private int maxSoilderCount; // 最大兵力
    [SerializeField] private float sercuityCount = 1f; // 防守时兵力乘数
    [SerializeField] private SettlementLevelSO settlementLevelSO; // 等级效果
    [SerializeField] private int speed; // 增加兵力速度
    [Header("owner")]
    [SerializeField] private int ownerNo; // 归属势力
    [SerializeField] private int ownerDay; // 归属势力天数

    private void Start()
    {
    }


    public int ReduceSoilder(int count)
    {
        int reduceCount = soilderCount - count;
        if (reduceCount < 0)
        {
            reduceCount = soilderCount;
            soilderCount = 0;
            print(settlementName + " 兵力已空！");
            return reduceCount;
        }
        soilderCount -= count;
        print(settlementName + " 兵力减少:" + count);
        return count;
    }

    public void AddSoilder(int count)
    {
        soilderCount += count;
        if (soilderCount > maxSoilderCount)
        {
            print(settlementName + " 兵力已达到最大！");
            soilderCount = maxSoilderCount;
        }
        else
        {
            print(settlementName + " 兵力增加:"+ count);
        }
    }





}
